package controller

import (
	"github.com/gin-gonic/gin"
	"kf/tools"
)

// 生成base64的验证码
func GetCaptchaV1(c *gin.Context) {
	id, base64, _, err := tools.CreateImageCaptcha()
	if err != nil {
		c.JSON(500, gin.H{
			"code": 200,
			"msg":  "错误",
			"data": "验证码生成错误",
		})
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "一切ok",
		"data": gin.H{
			"captchaBase64": base64,
			"captchaKey":    id,
		},
	})
}
